<template>
  <div class="headleft">
    <ul class="left-entry">
      <li>
        <a href="/bindex" class="entry-title default-entry">
          <i class="el-icon-s-home"></i>
          <span>首页</span>
        </a>
      </li>
    
      <li v-if="loginUser.perms==='super'">
        <a href="/manage" class="entry-title default-entry" @click="userList()">
          <i class="el-icon-user-solid"></i>
          <span>管理</span>
        </a>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  name: "indexLeft",
  data() {
    return {

      loginUser:"",
    };
  },
  created(){
this.getLoginUser();
  },
  methods: {

    getLoginUser() {
      this.axios({
        method: "get",
        params: {},
        url: "http://localhost:8090/user/getLoginUser"
      })
        .then(res => {
          //res.data就是请求后端成功后返回的数据
          this.loginUser = res.data;
        
        })
        .catch(error => {
          //每一个页面都刷新时都会请求一次app.vue的created里面的方法
          this.$message.error(error.response.data.message);
        });
    },
  }
};
</script>
<style   scoped>
</style>